<template>
    <tpl src="res/tpl/components/dialog.tpl" width="260" height="350" title="英雄" :visible="visible">
        <txt :text="roleName" x="70" y="50" size="16" color="#ffffff"></txt>
        <img src="res/ui/bodyMan.png" x="90" y="120"></img>
        <img src="res/item/big/000057.png" x="49" y="75" @over="tipOn($event, 0)" @out="tipOut"></img>
        <img src="res/item/big/000062.png" x="89" y="132" @over="tipOn($event, 1)" @out="tipOut"></img>
        <img src="res/ui/ground3.png" x="190" y="100" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipNecklace.png" x="192" y="102"></img>
        <img src="res/ui/ground3.png" x="20" y="160" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipBangle.png" x="22" y="160"></img>
        <img src="res/ui/ground3.png" x="190" y="160" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipBangle.png" x="192" y="160"></img>
        <img src="res/ui/ground3.png" x="20" y="220" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipRing.png" x="22" y="222"></img>
        <img src="res/ui/ground3.png" x="190" y="220" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipRing.png" x="192" y="222"></img>
        <img src="res/ui/ground3.png" x="20" y="280" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipWeapon.png" x="22" y="280"></img>
        <img src="res/ui/ground3.png" x="76" y="280" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipBelt.png" x="78" y="280"></img>
        <img src="res/ui/ground3.png" x="133" y="280" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipShoe.png" x="135" y="280"></img>
        <img src="res/ui/ground3.png" x="190" y="280" width="50" height="50" grid="[7,7,7,7]"></img>
        <img src="res/ui/equipHat.png" x="192" y="280"></img>
    </tpl>
</template>

<script>
init(){
    this.roleName= "凯哥 的英雄";
    this.items= [
        {title: "屠龙", desc: "攻击: 5 - 35\n准确: +5\n幸运: +9\n等级: 35"},
        {title: "战神盔甲(男)", desc: "防御: 3 - 8\n魔御: 3 - 6\n攻击: 1 - 2\n等级: 35"}
    ];
}

create() {
    console.log("hero create");
}

update(delta) {

}

destroyed() {
    
}

tipOn(event, itemIndex){
    this.tipX = TIP.x = event.x + 1;
    this.tipY = TIP.y = event.y + 1;
    TIP.updateContent(this.items[itemIndex].title, this.items[itemIndex].desc);
    TIP.visible = true;
}

tipOut(event){
    TIP.visible = false;
}

</script>